#include "stdafx.h"
#include "Utility.h"

using namespace std;

vector<string> split(string str, string pattern){
	string::size_type pos;
	vector<string> result;
	str += pattern;
	int size = str.size();

	for(int i = 0; i < size; i++){
		pos = str.find(pattern, i);
		if(pos < size){
			string s = str.substr(i,pos - i);
			result.push_back(s);
			i = pos + pattern.size() - 1;
		}
	}
	return result;
}

void Reverse(char *pBegin, char *pEnd){
	if(pBegin == NULL || pEnd == NULL)
		return;
	while(pBegin < pEnd){
		char temp = *pBegin;
		*pBegin = *pEnd;
		*pEnd = temp;
		pBegin++;
		pEnd--;
	}
}